package bavaria.hightech.banking.comparator;

import java.util.Comparator;

import bavaria.hightech.banking.lists.Booking;

/**
 * class BookingReasonComparator implements Comparator
 * @author David
 *
 * @param <T>
 */
public class BookingReasonComparator<T> implements Comparator<Booking> {

	@Override
	public int compare(Booking o1, Booking o2) {
		if (o2.getReason() == null && o1.getReason() == null) {
			return 0;
		}
		if (o1.getReason() == null) {
			return 1;
		}
		if (o2.getReason() == null) {
			return -1;
		}
		return o1.getReason().compareTo(o2.getReason());
	}
}